home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / BOLEUI.PAK / COMMON.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  6KB  |  170 lines

  1. /*
  2.  * COMMON.H
  3.  *
  4.  * Structures and definitions applicable to all OLE 2.0 UI dialogs.
  5.  *
  6.  */
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 6.5
  10.  *
  11.  *      Copyright (c) 1994 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16. #ifndef _COMMON_H_
  17. #define _COMMON_H_
  18.  
  19.  
  20. //Macros to handle control message packing between Win16 and Win32
  21. #ifdef WIN32
  22.  
  23. #ifndef COMMANDPARAMS
  24. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  25.     WORD        wID     = LOWORD(wParam);                           \
  26.     WORD        wCode   = HIWORD(wParam);                           \
  27.     HWND        hWndMsg = (HWND)(UINT)lParam;
  28. #endif  //COMMANDPARAMS
  29.  
  30. #ifndef SendCommand
  31. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  32.             SendMessage(hWnd, WM_COMMAND, MAKELONG(wID, wCode)      \
  33.                         , (LPARAM)hControl)
  34. #endif  //SendCommand
  35.  
  36. #else   //Start !WIN32
  37.  
  38. #ifndef COMMANDPARAMS
  39. #define COMMANDPARAMS(wID, wCode, hWndMsg)                          \
  40.     WORD        wID     = LOWORD(wParam);                           \
  41.     WORD        wCode   = HIWORD(lParam);                           \
  42.     HWND        hWndMsg = (HWND)(UINT)lParam;
  43. #endif  //COMMANDPARAMS
  44.  
  45. #ifndef SendCommand
  46. #define SendCommand(hWnd, wID, wCode, hControl)                     \
  47.             SendMessage(hWnd, WM_COMMAND, wID                       \
  48.                         , MAKELONG(hControl, wCode))
  49. #endif  //SendCommand
  50.  
  51. #endif  
  52.  
  53.  
  54.  
  55. //Property labels used to store dialog structures and fonts
  56. #define STRUCTUREPROP       "Structure"
  57. #define FONTPROP            "Font"
  58.  
  59.  
  60. /*
  61.  * Standard structure for all dialogs.  This commonality lets us make
  62.  * a single piece of code that will validate this entire structure and
  63.  * perform any necessary initialization.
  64.  */
  65.  
  66. typedef struct tagOLEUISTANDARD
  67.     {
  68.     //These IN fields are standard across all OLEUI dialog functions.
  69.     DWORD           cbStruct;       //Structure Size
  70.     DWORD           dwFlags;        //IN-OUT:  Flags
  71.     HWND            hWndOwner;      //Owning window
  72.     LPCSTR          lpszCaption;    //Dialog caption bar contents
  73.     LPFNOLEUIHOOK   lpfnHook;       //Hook callback
  74.     LPARAM          lCustData;      //Custom data to pass to hook
  75.     HINSTANCE       hInstance;      //Instance for customized template name
  76.     LPCSTR          lpszTemplate;   //Customized template name
  77.     HRSRC           hResource;      //Customized template handle
  78.  
  79.     DWORD           dwIBApplication;  //Bolero app ptr for help
  80.     HHOOK           hHook;            //Bolero F1 hook
  81.     HTASK           hTask;            //Bolero task for F1 hook
  82.     } OLEUISTANDARD, *POLEUISTANDARD, FAR *LPOLEUISTANDARD;
  83.  
  84.  
  85.  
  86. //Function prototypes
  87. //COMMON.C
  88. UINT  WINAPI  UStandardValidation(const LPOLEUISTANDARD, const UINT, const HGLOBAL FAR *);
  89. UINT  WINAPI  UStandardInvocation(DLGPROC, LPOLEUISTANDARD, HGLOBAL, LPCSTR);
  90. LPVOID WINAPI LpvStandardInit(HWND, UINT, BOOL, HFONT FAR *);
  91. LPVOID WINAPI LpvStandardEntry(HWND, UINT, WPARAM, LPARAM, UINT FAR *);
  92. UINT WINAPI   UStandardHook(LPVOID, HWND, UINT, WPARAM, LPARAM);
  93. void WINAPI   StandardCleanup(LPVOID, HWND);
  94. void WINAPI   StandardShowDlgItem(HWND hDlg, int idControl, int nCmdShow);
  95.  
  96. //DRAWICON.C
  97.  
  98. //Structure for label and source extraction from a metafile
  99. typedef struct tagLABELEXTRACT
  100.     {
  101.     LPSTR       lpsz;
  102.     UINT        Index;      // index in lpsz (so we can retrieve 2+ lines)
  103.     DWORD       PrevIndex;  // index of last line (so we can mimic word wrap)
  104.  
  105.     union
  106.         {
  107.         UINT    cch;        //Length of label for label extraction
  108.         UINT    iIcon;      //Index of icon in source extraction.
  109.         } u;
  110.  
  111.     //For internal use in enum procs
  112.     BOOL        fFoundIconOnly;
  113.     BOOL        fFoundSource;
  114.     BOOL        fFoundIndex;
  115.     } LABELEXTRACT, FAR * LPLABELEXTRACT;
  116.  
  117.  
  118. //Structure for extracting icons from a metafile (CreateIcon parameters)
  119. typedef struct tagICONEXTRACT
  120.     {
  121.     HICON       hIcon;          //Icon created in the enumeration proc.
  122.  
  123.     /*
  124.      * Since we want to handle multitasking well we have the caller
  125.      * of the enumeration proc instantiate these variables instead of
  126.      * using statics in the enum proc (which would be bad).
  127.      */
  128.     BOOL        fAND;
  129.     HGLOBAL     hMemAND;        //Enumeration proc allocates and copies
  130.     } ICONEXTRACT, FAR * LPICONEXTRACT;
  131.  
  132.  
  133. //Structure to use to pass info to EnumMetafileDraw
  134. typedef struct tagDRAWINFO
  135.     {
  136.     RECT     Rect;
  137.     BOOL     fIconOnly;
  138.     } DRAWINFO, FAR * LPDRAWINFO;
  139.  
  140.  
  141. int CALLBACK EXPORT EnumMetafileIconDraw(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPARAM);
  142. int CALLBACK EXPORT EnumMetafileExtractLabel(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  143. int CALLBACK EXPORT EnumMetafileExtractIcon(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPICONEXTRACT);
  144. int CALLBACK EXPORT EnumMetafileExtractIconSource(HDC, HANDLETABLE FAR *, METARECORD FAR *, int, LPLABELEXTRACT);
  145.  
  146.  
  147. //Shared globals:  our instance, registered messages used from all dialogs and clipboard
  148. // formats used by the PasteSpecial dialog
  149. extern HINSTANCE  ghInst;
  150.  
  151. extern UINT       uMsgHelp;
  152. extern UINT       uMsgEndDialog;
  153. extern UINT       uMsgBrowse;
  154. extern UINT       uMsgChangeIcon;
  155. extern UINT       uMsgFileOKString;
  156. extern UINT       uMsgCloseBusyDlg;
  157.  
  158. extern UINT       cfObjectDescriptor;
  159. extern UINT       cfLinkSrcDescriptor;
  160. extern UINT       cfEmbedSource;
  161. extern UINT       cfEmbeddedObject;
  162. extern UINT       cfLinkSource;
  163. extern UINT       cfOwnerLink;
  164. extern UINT       cfFileName;
  165.  
  166. //Standard control identifiers
  167. #define ID_NULL                         98
  168.  
  169. #endif //_COMMON_H_
  170.